/**
 * 
 */
package sk.stuba.fiit.foo07.genex.gui;

import java.awt.Component;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;

import sk.stuba.fiit.foo07.genex.beans.Test;

/**
 * @author _mizu_
 * 
 */
public class TreeIconRenderer extends DefaultTreeCellRenderer {

    /**
     * 
     */
    private static final long serialVersionUID = 1936460107108983495L;

    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value,
            boolean sel, boolean expanded, boolean leaf, int row,
            boolean hasFocus) {

        Object obj = ((DefaultMutableTreeNode) value).getUserObject();
        leaf = obj instanceof Test ? true : false;

        return super.getTreeCellRendererComponent(tree, value, sel, expanded,
                leaf, row, hasFocus);
    }

}
